package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;

import com.chanyachting.emall.util.RequestUtil;

public class AdForm extends ActionForm {
	
	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String summary;   //广告说明
	private java.lang.String type;  //广告类型
	private java.lang.String pageUrl;   //广告呈现页面URL
	private java.lang.String content;   //广告文字内容 （可能是 脚本代码）

	private FormFile file;   //广告图片上传对象
	
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		RequestUtil ru=new RequestUtil(request);
		
		ActionErrors errors=new ActionErrors();
		
		if(this.getSummary()==null || this.getSummary().equals("")){
			
			errors.add("",new ActionMessage(""));
			
			ru.setMsg("Summary must not null!");
		}
		
		if(this.getPageUrl()==null || this.getPageUrl().equals("")){
			
			errors.add("",new ActionMessage(""));
			
			ru.setMsg("PageUrl must not null!");
			
		}

		return errors;
	}
	
	
	
	
	
	public FormFile getFile() {
		return file;
	}





	public void setFile(FormFile file) {
		this.file = file;
	}





	public java.lang.String getSummary() {
		return summary;
	}




	public void setSummary(java.lang.String summary) {
		this.summary = summary;
	}




	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.String getType() {
		return type;
	}
	public void setType(java.lang.String type) {
		this.type = type;
	}
	public java.lang.String getPageUrl() {
		return pageUrl;
	}
	public void setPageUrl(java.lang.String pageUrl) {
		this.pageUrl = pageUrl;
	}
	public java.lang.String getContent() {
		return content;
	}
	public void setContent(java.lang.String content) {
		this.content = content;
	}
	
	

}
